; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes=inline < %s | FileCheck %s
; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -passes='cgscc(inline)' < %s | FileCheck %s

define i32 @func_default() {
; CHECK-LABEL: @func_default(
; CHECK-NEXT:    ret i32 0
;
  ret i32 0
}

define i32 @func_ieee_ieee() #0 {
; CHECK-LABEL: @func_ieee_ieee(
; CHECK-NEXT:    ret i32 1
;
  ret i32 1
}

define i32 @func_psz_psz() #1 {
; CHECK-LABEL: @func_psz_psz(
; CHECK-NEXT:    ret i32 2
;
  ret i32 2
}

define i32 @func_psz_ieee() #2 {
; CHECK-LABEL: @func_psz_ieee(
; CHECK-NEXT:    ret i32 3
;
  ret i32 3
}

define i32 @func_ieee_psz() #3 {
; CHECK-LABEL: @func_ieee_psz(
; CHECK-NEXT:    ret i32 4
;
  ret i32 4
}

define i32 @call_default_from_psz_psz() #1 {
; CHECK-LABEL: @call_default_from_psz_psz(
; CHECK-NEXT:    ret i32 0
;
  %call = call i32 @func_default()
  ret i32 %call
}

define i32 @call_ieee_ieee_from_ieee_ieee() #0 {
; CHECK-LABEL: @call_ieee_ieee_from_ieee_ieee(
; CHECK-NEXT:    ret i32 1
;
  %call = call i32 @func_ieee_ieee()
  ret i32 %call
}

define i32 @call_ieee_ieee_from_psz_psz() #1 {
; CHECK-LABEL: @call_ieee_ieee_from_psz_psz(
; CHECK-NEXT:    ret i32 1
;
  %call = call i32 @func_ieee_ieee()
  ret i32 %call
}

define i32 @call_psz_psz_from_ieee_ieee() #0 {
; CHECK-LABEL: @call_psz_psz_from_ieee_ieee(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_psz_psz()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_psz_psz()
  ret i32 %call
}

define i32 @call_psz_psz_from_psz_psz() #1 {
; CHECK-LABEL: @call_psz_psz_from_psz_psz(
; CHECK-NEXT:    ret i32 2
;
  %call = call i32 @func_psz_psz()
  ret i32 %call
}

define i32 @call_psz_ieee_from_psz_psz() #1 {
; CHECK-LABEL: @call_psz_ieee_from_psz_psz(
; CHECK-NEXT:    ret i32 3
;
  %call = call i32 @func_psz_ieee()
  ret i32 %call
}

define i32 @call_ieee_psz_from_psz_psz() #1 {
; CHECK-LABEL: @call_ieee_psz_from_psz_psz(
; CHECK-NEXT:    ret i32 4
;
  %call = call i32 @func_ieee_psz()
  ret i32 %call
}

define i32 @call_psz_ieee_from_ieee_ieee() #0 {
; CHECK-LABEL: @call_psz_ieee_from_ieee_ieee(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_psz_ieee()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_psz_ieee()
  ret i32 %call
}

define i32 @call_ieee_psz_from_ieee_ieee() #0 {
; CHECK-LABEL: @call_ieee_psz_from_ieee_ieee(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_ieee_psz()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_ieee_psz()
  ret i32 %call
}

define i32 @call_ieee_ieee_from_psz_ieee() #2 {
; CHECK-LABEL: @call_ieee_ieee_from_psz_ieee(
; CHECK-NEXT:    ret i32 1
;
  %call = call i32 @func_ieee_ieee()
  ret i32 %call
}

define i32 @call_psz_ieee_from_psz_ieee() #2 {
; CHECK-LABEL: @call_psz_ieee_from_psz_ieee(
; CHECK-NEXT:    ret i32 3
;
  %call = call i32 @func_psz_ieee()
  ret i32 %call
}

define i32 @call_ieee_psz_from_psz_ieee() #2 {
; CHECK-LABEL: @call_ieee_psz_from_psz_ieee(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_ieee_psz()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_ieee_psz()
  ret i32 %call
}

define i32 @call_psz_psz_from_psz_ieee() #2 {
; CHECK-LABEL: @call_psz_psz_from_psz_ieee(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_psz_psz()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_psz_psz()
  ret i32 %call
}

define i32 @call_ieee_ieee_from_ieee_psz() #3 {
; CHECK-LABEL: @call_ieee_ieee_from_ieee_psz(
; CHECK-NEXT:    ret i32 1
;
  %call = call i32 @func_ieee_ieee()
  ret i32 %call
}

define i32 @call_psz_ieee_from_ieee_psz() #3 {
; CHECK-LABEL: @call_psz_ieee_from_ieee_psz(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_psz_ieee()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_psz_ieee()
  ret i32 %call
}

define i32 @call_ieee_psz_from_ieee_psz() #3 {
; CHECK-LABEL: @call_ieee_psz_from_ieee_psz(
; CHECK-NEXT:    ret i32 4
;
  %call = call i32 @func_ieee_psz()
  ret i32 %call
}

define i32 @call_psz_psz_from_ieee_psz() #3 {
; CHECK-LABEL: @call_psz_psz_from_ieee_psz(
; CHECK-NEXT:    [[CALL:%.*]] = call i32 @func_psz_psz()
; CHECK-NEXT:    ret i32 [[CALL]]
;
  %call = call i32 @func_psz_psz()
  ret i32 %call
}

attributes #0 = { "denormal-fp-math"="ieee,ieee" }
attributes #1 = { "denormal-fp-math"="preserve-sign,preserve-sign" }
attributes #2 = { "denormal-fp-math"="preserve-sign,ieee" }
attributes #3 = { "denormal-fp-math"="ieee,preserve-sign" }
